package SBD.CRUD;

import SBD.Servicios.Conexion;
import SBD.Servicios.FactoriaServicios;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;


/**
* @class OperacionesBD
* @author Mauricio Alvarez.
* @brief Contiene los metodos CRUD a la BD para las operaciones de soporte.
*/
public class OperacionesBD {


    //////////////////////////
    // OPERACIONES
    //////////////////////////

    /**
     * @brief Guarda los Stopword en la BD.
     * @param Stopwords.
     * @return void
    */
    public void GuardarStopwords(ArrayList Stopwords) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException, java.sql.SQLException, Error, IOException
    {
        Conexion cdb = FactoriaServicios.getInstancia().getConexionBD();
        
        for (Iterator<String> iter = Stopwords.iterator(); iter.hasNext();  )
        {
            //Se guarda cada stopwords:
            String stopword = iter.next();
            System.out.println("Palabras Stopwords: "+ stopword);
            cdb.un_sql = "INSERT INTO STOPWORD(stopword) VALUES ('" + stopword + "')";
            cdb.un_st.executeUpdate(cdb.un_sql);
        }
    }


    /**
     * @brief Carga los Stopword de la BD.
     * @param No tiene.
     * @return Map<String,Integer>
    */
    public Map<String,Integer> CargarStopwords() throws ClassNotFoundException,
                                                        InstantiationException,
                                                        IllegalAccessException,
                                                        IOException,
                                                        SQLException
    {
        Map Stopword = new HashMap();
        int id_stopword = 0;
        String stopword;

        Conexion cdb = FactoriaServicios.getInstancia().getConexionBD();
        cdb.un_sql = "SELECT * FROM STOPWORD;";
        cdb.resultado = cdb.un_st.executeQuery(cdb.un_sql);

        if (cdb.resultado != null)
        {
            while (cdb.resultado.next())
            {
                id_stopword = cdb.resultado.getInt("id_stopword");
                stopword = cdb.resultado.getString("stopword");
                Stopword.put(stopword, id_stopword);
            }
        }else{
            //Generación de error
            //throw new Error(-1, "Consulta a Registro " + id_stopword + "a devuelto un recorset null. Ubicación= " +
            //        this.getClass().getName().toString());
        }

        return Stopword;
    }


    /**
     * @brief Borra todos los Stopword de la BD.
     * @param No tiene.
     * @return void
    */
    public void BorrarStopwords() throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException, SQLException
    {
        Conexion cdb = FactoriaServicios.getInstancia().getConexionBD();
        cdb.un_sql = "DELETE FROM STOPWORD;";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table STOPWORD auto_increment=1;";
        cdb.un_st.executeUpdate(cdb.un_sql);

    }


    /**
     * @brief Borra todas las mediciones de las métricas de la BD.
     * @param No tiene.
     * @return void
    */
    public void BorrarMediciones() throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException, SQLException
    {
        Conexion cdb = FactoriaServicios.getInstancia().getConexionBD();
        cdb.un_sql = "DELETE FROM MEDICION_SETF_SN; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETF_SN auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETF_N; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETF_N auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETF_S; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETF_S auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETFIDF_SN; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETFIDF_SN auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETFIDF_N; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETFIDF_N auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETFIDF_S; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETFIDF_S auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETFIDF_O_SN; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETFIDF_O_SN auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETFIDF_O_N;  ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETFIDF_O_N auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETFIDF_O_S; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETFIDF_O_S auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SEOKAPI; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SEOKAPI auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM similitud_euclidiana; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table similitud_euclidiana auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETF_SN_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETF_SN_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETF_N_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETF_N_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETF_S_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETF_S_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETFIDF_SN_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETFIDF_SN_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETFIDF_N_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETFIDF_N_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETFIDF_S_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETFIDF_S_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETFIDF_O_SN_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETFIDF_O_SN_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETFIDF_O_N_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETFIDF_O_N_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SETFIDF_O_S_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SETFIDF_O_S_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SEOKAPI_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SEOKAPI_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM similitud_euclidiana_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table similitud_euclidiana_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTF_SN; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTF_SN auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTF_N; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTF_N auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTF_S; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTF_S auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTFIDF_SN; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTFIDF_SN auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTFIDF_N; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTFIDF_N auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTFIDF_S; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTFIDF_S auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTFIDF_O_SN; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTFIDF_O_SN auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTFIDF_O_N; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTFIDF_O_N auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTFIDF_O_S; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTFIDF_O_S auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCOKAPI; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCOKAPI auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM similitud_coseno; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table similitud_coseno auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTF_SN_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTF_SN_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTF_N_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTF_N_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTF_S_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTF_S_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTFIDF_SN_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTFIDF_SN_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTFIDF_N_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTFIDF_N_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTFIDF_S_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTFIDF_S_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTFIDF_O_SN_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTFIDF_O_SN_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTFIDF_O_N_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTFIDF_O_N_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCTFIDF_O_S_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCTFIDF_O_S_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCOKAPI_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCOKAPI_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM similitud_coseno_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table similitud_coseno_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_JACCARD; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_JACCARD auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM JACCARD; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table JACCARD auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_JACCARD_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_JACCARD_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM JACCARD_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table JACCARD_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TF_SN; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TF_SN auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TF_N; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TF_N auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TF_S; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TF_S auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TFIDF_SN; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TFIDF_SN auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TFIDF_N; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TFIDF_N auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TFIDF_S; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TFIDF_S auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TFIDF_O_SN; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TFIDF_O_SN auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TFIDF_O_N; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TFIDF_O_N auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TFIDF_O_S; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TFIDF_O_S auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_OKAPI; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_OKAPI auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCORE; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCORE auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TF_SN_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TF_SN_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TF_N_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TF_N_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TF_S_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TF_S_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TFIDF_SN_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TFIDF_SN_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TFIDF_N_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TFIDF_N_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TFIDF_S_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TFIDF_S_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TFIDF_O_SN_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TFIDF_O_SN_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TFIDF_O_N_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TFIDF_O_N_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_TFIDF_O_S_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_TFIDF_O_S_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM RANKING_OKAPI_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RANKING_OKAPI_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCORE_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCORE_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM SCORE; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table SCORE auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM MEDICION_SCORE_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table MEDICION_SCORE_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM SCORE_ST; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql =  "alter table SCORE_ST auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        
    }

    public void BorrarPaginas() throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException, SQLException 
    {
        Conexion cdb = FactoriaServicios.getInstancia().getConexionBD();
        cdb.un_sql = "DELETE FROM RELACION_PAGINAS; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table RELACION_PAGINAS auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM PAGINA; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table PAGINA auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "DELETE FROM SITIO; ";
        cdb.un_st.executeUpdate(cdb.un_sql);
        cdb.un_sql = "alter table SITIO auto_increment=1; ";
        cdb.un_st.executeUpdate(cdb.un_sql);        
        
    }

}//FIN OperacionesBD
